from kubernetes import client, config
import os
from kubernetes import client, config
file_path = os.path.join('/config')
config.load_kube_config(file_path)  # 指定kubeconfig配置文件
apps_api = client.AppsV1Api()  # 资源接口类实例化

for dp in apps_api.list_deployment_for_all_namespaces().items:
    print(dp)

